package cm.tl.pms.sys.entity;

import cm.tl.pms.sys.desensitization.Desensitization;
import cm.tl.pms.sys.desensitization.DesensitizationTypeEnum;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author laker
 * @since 2021-08-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class SysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "user_id", type = IdType.AUTO)
    private Long userId;

    @ExcelProperty(value = "用户登录名称")
    private String userName;

    @ExcelProperty(value = "登录密码")
    @Desensitization(type = DesensitizationTypeEnum.PASSWORD)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    @ExcelProperty(value = "昵称")
    private String nickName;

    private Long deptId;
    @TableField(exist = false)
    private SysDept dept;
    @ExcelProperty(value = "部门名称")
    @TableField(exist = false)
    private String deptName;

    @ExcelProperty(value = "性别")
    private Integer sex;

    @ExcelProperty(value = "手机号")
    //@Desensitization(type = DesensitizationTypeEnum.MOBILE_PHONE)
    private String phone;

    /**
     * 0.禁用 1.启用
     */
    private Integer enable;
    //@Desensitization(type = DesensitizationTypeEnum.EMAIL)
    private String email;

    private String avatar;

    /**
     * 是否首次登录 0.否 1.是
     */
    private Integer loginFirst;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @ExcelProperty(value = "角色")
    @TableField(exist = false)
    private String roleIds;


    @TableField(exist = false)
    private Long roleId;
    /**
     * 角色
     */
    @TableField(exist = false)
    private String roleName;

    @TableField(exist = false)
    private String dataRoleId;

}
